package com.example.repository;

import com.example.entity.Goods;
import com.example.repository.expand.ExpandJpaRepository;
import com.example.repository.parameter.Operator;
import com.example.repository.parameter.Predicate;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by babyant on 17/3/6.
 */
@Repository
public interface GoodsRepository extends ExpandJpaRepository<Goods,Long> {

    @CacheEvict(value = "goodsCache",allEntries = true)
    @Override
    Goods save(Goods goods);


    @Override
    Page<Goods> findAll(Pageable pageable);


    @Cacheable(value= "goodsCache")
    @Override
    List<Goods> findAll(Iterable<Predicate> predicates, Operator operator);

    @Override
    Goods findOne(Long id);
}
